#ifndef NctiRenderTriangleItem_H
#define NctiRenderTriangleItem_H
#include "NctiRenderGeometryItem.h"
#include "ncti_include.h"

namespace NCTI
{
    /**
     * @brief Face Geometry Render Object
     */
	class DECL_NCTI_RENDER NctiRenderTriangleItem : public NctiRenderGeometryItem
	{
		NCTI_RENDER_FUNCTIONS(NctiRenderTriangleItem)
	public:
		NctiRenderTriangleItem();

        /**
         * @brief construct
         * @param[in] i_NctiMeshData face data
         * @see NctiMeshData
         */
		NctiRenderTriangleItem(const NctiMeshData& i_NctiMeshData);

        /**
         * @brief completion virtual function
         * @return point count
         */
        Ncti_Size GetGeomCount()const override;

        /**
         * @brief get point position
         */
        NctiPosition GetPosition(int)const override;

        /**
         * @brief Get bounding box.completion virtual function
         */
        bool GetBox(NctiViewerRenderer* i_pViewerRenderer, NctiPosition& o_Max, NctiPosition& o_Min)override;

        /**
         * @brief clone self.completion virtual function
         */
        NctiRenderGeometryItem* clone() override;

        /**
         * @brief reset the position
         */
		void SetPositions(const std::vector<Ncti_Float>& i_positions);

        /**
         * @brief reset the normal
         */
		void SetNormals(const std::vector<Ncti_Float>& i_normals);

        /**
         * @brief reset the triangle
         */
        void SetTriangles(const std::vector<Ncti_UInteger>& i_triangles);

        /**
         * @brief reset the uvs
         */
		void SetUvs(const std::vector<Ncti_Float>& i_uvs);

        /**
         * @brief direct update the render vertex data without rebuild the scene
         * @param[in] i_pViewerRenderer render to display
         * @param[in] FloatVec vertex data
         * @param[in] i_size FloatVec size
         */
		void SetVertexBuffer(NctiViewerRenderer* i_pViewerRenderer, const Ncti_Float* FloatVec, Ncti_Size i_size);

        /**
         * @brief get triangle data
         */
		const std::vector<Ncti_UInteger>& GettrianglesData()const;

        /**
         * @brief get normal data
         */
		const std::vector<Ncti_Float>& GetnormalsData();

        /**
         * @brief get uvs data
         */
		const Ncti_Float* GetuvsData();

        /**
         * @brief Point ray hit to this geometry
         * @param[in] i_pt position
         * @param[in] i_area area
         * @param[out] o_pos interest position
         * @param[out] o_t
         * @param[in] trans,if exist ,means multiple this geometry
         * @return true for intersect with this geometry
         */
        bool PointRayHit(const NctiPosition& i_pt, Ncti_Double i_area, const NctiVector& i_vec, NctiPosition& o_pos, Ncti_Double& o_t, NctiTransf* trans) const override;

	};
}
#endif
